<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>差旅费用</title>

    <style type="text/css">
        @import url("/pages/import/base.css");
        html, body{ margin:0; height:100%; }
    </style>
    <script type="text/javascript" src="/pages/import/base.js"></script>

</head>
<body class="easyui-layout">

    <div data-options="region:'center',iconCls:'icon-reload',title:'',split:true" style="width:100%;height: 100%">
        <table id="dg" class='easyui-datagrid' style="width:100%;height:100%" title="" data-options="
                  rownumbers:true,
                  singleSelect:true,
                  autoRowHeight:false,
                  pagination:false,
                  fitColumns:false,
                  striped:true,
                  checkOnSelect:true,
                  selectOnCheck:true,
                  collapsible:false,
                  toolbar:'#tb',
                  pageSize:20">
            <thead>
              <tr href="#">
                    <th field="id" align="center" hidden ="true">id</th>
                    <th field="title" align="center">会议标题</th>
                    <th field="date">会议日期</th>
                    <th field="actual_name">主持人</th>
              </tr>
            </thead>
          </table>
          <div id="tb" style="height:35px">            
            <a id='btnInsert' href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'fa fa-plus',plain:true" onclick="add()" style="margin-left: 30px">新增</a>
            <a id='btnInsert' href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'fa fa-pencil',plain:true" onclick="edit()" style="margin-left: 0px">修改</a>      
            <a id='btnInsert' href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'fa fa-mouse-pointer',plain:true" onclick="view()" style="margin-left: 0px">查看</a>                
            <a id='btnInsert' href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'fa fa-trash',plain:true" onclick="dele()" style="margin-left: 0px">删除</a>                       
            <form id="queryForm" class="search-box">
              </form>            
          </div>
       </div>
    </div>




  <script type="text/javascript">
    var project = new Object();


    $(function(){
   
        $('#dg').datagrid({
            url: '/develop/url/getUrl.do',
            queryParams: {
                name: 'getMeetingList'
            },
            method: 'get',
            onDblClickCell:function(index,field,value){
                view();
            }
        })                            
            
    });
    

    var formateStatus = function(val,row)
    {
        if(row.is_finish == true && row.finish_date > row.plan_end_date)
            return '<font color="orange"><i class="fa fa-calendar-times-o"></i>延迟</font>';     
        if(row.is_finish == true)
            return '<font color="green"><i class="fa fa-calendar-check-o"></i>准时</font>';     
        // if(row.is_finish == false && !shuoheUtil.checkNull(row.finish_date))
        //     return '<font color="red"><i class="fa fa-calendar-times-o text-danger"></i></font>';

    }
    var formateDate = function(val,row)
    {
        if(row.is_finish == false)
            return moment(row.plan_end_date).diff(moment(), 'days')        
    }
    function finish()
    {
        var row = $('#dg').datagrid('getSelected');
        if(row == null)
        {
          layerMsgCustom('必须选择一条数据');
          return;
        }
        layer.open({
            type: 2,
            title: '完成任务',
            shadeClose: false,
            shade: 0.3,
            maxmin: true, //开启最大化最小化按钮
            area: ['500px','400px'],
            content: 'form/editTask.jsp?masterplan_id=' + row.masterplan_id
        })
    }
	</script>




</body>
</html>
<script type="text/javascript">
    function add() {
      layer.open({
          type: 2,
          title: '新增设备',
          shadeClose: false,
          shade: 0.3,
          maxmin: true, //开启最大化最小化按钮s
          area: ['900px',document.body.clientHeight - 20 + 'px'],
          content: 'form/addMeeting.jsp'
      })
    }
  function view()
  {
      var row = $('#dg').datagrid('getSelected');
        if(row == null)
        {
          layerMsgCustom('必须选择一条数据');
          return;
        }

        layer.open({
            type: 2,
            // title: '查看详情',
            shadeClose: true,
            shade: 0.3,
            // maxmin: true, //开启最大化最小化按钮
            area: ['900px', (document.body.clientHeight - 100)+'px'],
            content: 'form/viewMeeting.jsp'
        })
  }

    function edit() {

        var row = $('#dg').datagrid('getSelected');
        if (row == null) {
            layerMsgCustom('必须选择一条数据');
            return;
        }

        layer.open({
            type: 2,
            title: '修改设备',
            shadeClose: false,
            shade: 0.3,
            maxmin: true, //开启最大化最小化按钮
            area: ['900px',document.body.clientHeight - 20 + 'px'],
            content: 'form/editMeeting.jsp'
        })
    }
    function dele() {
        var row = $('#dg').datagrid('getSelected');
        if (row == null) {
            layerMsgCustom('必须选择一条数据');
            return;
        }
        //删除操作属于危险操作，给出提示
        $.messager.confirm('友情提示', '<font size="4px">您确定要删除这条数据吗?</font>', function(r) {
            if (r) {
                shuoheUtil.layerTopMaskOn();
                $.ajax({
                    url: "/pm2/meeting/delete.do",
                    type: "POST",
                    dataType: 'json',
                    data: {
                        'id': row.id
                    },
                    error: function() //失败
                    {
                        shuoheUtil.layerTopMaskOff();
                    },
                    success: function(data) //成功
                    {
                        updateSuccess();
                        shuoheUtil.layerTopMaskOff();
                        if(data.result)
                        {
                            shuoheUtil.layerMsgOK(data.describe);
                        }
                        else
                        {
                            shuoheUtil.layerMsgError(data.describe);
                        }
                    }
                });
            }
        });
    }


  function updateSuccess()
  {
    $('#dg').datagrid('reload');

  }
  
  
  function functionQuery() {
	    loadDg();
	  }
	  function functionClear() {
	    $('#equipment_id').textbox('clear');
	    $('#equipment_name').textbox('clear');
	    $('#use_department').textbox('clear');
	    $('#actual_name').textbox('clear');
	    loadDg();
	  }


</script>
